package com.sogoodsoft.service.crm;

import java.util.Properties;

import com.sogoodsoft.util.InfosysUtils;

public class OrderSerialService {
	
	private static Properties prop; 
	private static String path = "classes/order.properties";
	private final static String key = "orderSerialNO";
	public synchronized static String getSerial(){
		String serial = "";
		prop = InfosysUtils.prop(path);
		serial = String.valueOf(prop.get(key));
		long val = Long.parseLong(serial);
		val = val+1;
		serial = String.valueOf(val);
		prop.setProperty(key, serial);
		InfosysUtils.store(prop, path);
		return serial;
	}

	
	public static void main(String arg[]){
		for(int i=0;i<50;i++){
			OrderThread ot = new OrderThread();
			ot.start();
		}
	}
	
	
}
